package com.tudouji.project.quality.service.impl;

import java.util.List;

import com.tudouji.common.core.lang.UUID;
import com.tudouji.common.utils.DateUtils;
import com.tudouji.common.utils.IdUtils;
import com.tudouji.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tudouji.project.quality.mapper.QamainMapper;
import com.tudouji.project.quality.domain.Qamain;
import com.tudouji.project.quality.service.IQamainService;

/**
 * 质检标准Service业务层处理
 * 
 * @author wf
 * @date 2021-03-09
 */
@Service
public class QamainServiceImpl implements IQamainService 
{
    @Autowired
    private QamainMapper qamainMapper;

    /**
     * 查询质检标准
     * 
     * @param guid 质检标准ID
     * @return 质检标准
     */
    @Override
    public Qamain selectQamainById(String guid)
    {
        return qamainMapper.selectQamainById(guid);
    }

    /**
     * 查询质检标准列表
     * 
     * @param qamain 质检标准
     * @return 质检标准
     */
    @Override
    public List<Qamain> selectQamainList(Qamain qamain)
    {
        return qamainMapper.selectQamainList(qamain);
    }

    /**
     * 新增质检标准
     * 
     * @param qamain 质检标准
     * @return 结果
     */
    @Override
    public int insertQamain(Qamain qamain)
    {
        qamain.setOperatorid(SecurityUtils.getLoginUser().getUser().getUserId().toString());
        qamain.setCreatetime(DateUtils.getNowDate());
        qamain.setGuid(IdUtils.fastSimpleUUID());
        return qamainMapper.insertQamain(qamain);
    }

    /**
     * 修改质检标准
     * 
     * @param qamain 质检标准
     * @return 结果
     */
    @Override
    public int updateQamain(Qamain qamain)
    {
        return qamainMapper.updateQamain(qamain);
    }

    /**
     * 批量删除质检标准
     * 
     * @param guids 需要删除的质检标准ID
     * @return 结果
     */
    @Override
    public int deleteQamainByIds(String[] guids)
    {
        return qamainMapper.deleteQamainByIds(guids);
    }

    /**
     * 删除质检标准信息
     * 
     * @param guid 质检标准ID
     * @return 结果
     */
    @Override
    public int deleteQamainById(String guid)
    {
        return qamainMapper.deleteQamainById(guid);
    }
}
